import { createStore } from 'vuex'

export default createStore({
  state: {
    token: localStorage.token ? JSON.parse(localStorage.token) : ''
  },
  getters: {
  },
  mutations: {
    saveToken ( state, payload ) {
      state.token = payload.token;

      localStorage.setItem('token', JSON.stringify(state.token))
    }
  },
  actions: {
  },
  modules: {
  }
})
